/*
Copyright (c) 2006 - 2008  Universitaet Osnabrueck, virtUOS
Authors: Markus Ketterl, Johannes Emden, Nils Schuhmacher, Andreas Rickling

This file is part of virtPresenter.

virtPresenter is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

virtPresenter is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with virtPresenter.  If not, see <http://www.gnu.org/licenses/>.
*/

package virtPresenter.business
{
	import com.adobe.cairngorm.business.ServiceLocator;	
	import mx.rpc.AsyncToken;
	import mx.rpc.IResponder;
	import mx.rpc.http.HTTPService;
	
	/**
	 * Class delegates the information from video.xml via a HTTPService
	 * to the responder. 
	 */
	public class VideoXMLDelegate
	{		
		private var responder:IResponder;
		
		/**
		 * Constructor of the VideoXMLDelegate. Recieves a LoadVideoXMLCommand
		 * as responder.
		 * 
		 * @parameters responder LoadVideoXMLCommand 
		 * 
		 * @see virtPresenter.commands.LoadVideoXMLCommand
		 */
		public function VideoXMLDelegate(responder:IResponder)
		{
			this.responder = responder;
		}
		
		/**
		 * Loads the video.xml via a HTTPService and delivers it to the result method
		 * of its responder.
		 * 
		 * @parameters folder Folder where to load video.xml from
		 * 
		 * @see virtPresenter.commands.LoadVideoXMLCommand
		 */
		public function getVideoURL(folder:String):void
		{
			var service:HTTPService = ServiceLocator.getInstance().getHTTPService("videoXMLService");	
			var token:AsyncToken = service.send();
			token.addResponder(responder);
		}		
	}
}
